package com.item.yxlottery.yxlottery.activity;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageButton;
import android.widget.TextView;

import com.item.yxlottery.yxlottery.R;
import com.item.yxlottery.yxlottery.base.BaseActivity;
import com.item.yxlottery.yxlottery.views.ClearEditText;
import com.zhy.autolayout.AutoLinearLayout;
import com.zhy.autolayout.AutoRelativeLayout;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by tuxing on 2017/1/17.
 * 添加银行卡
 */

public class AddBankCard extends BaseActivity implements View.OnClickListener {
    @Bind(R.id.addbankcard_tv_bankname)
    TextView mTvBankname;
    @Bind(R.id.addbankcard_ll_selectbank)
    AutoLinearLayout mLlSelectbank;
    @Bind(R.id.addbankcard_tv_banknumber)
    ClearEditText mTvBanknumber;
    @Bind(R.id.addbankcard_tv_add)
    TextView mTvAdd;

    @Override
    protected void setCustomActionBar(ImageButton ibActionbarLeft, TextView tvActionBarTitle, ImageButton ibActionbarRight, AutoRelativeLayout layoutActionbar) {
        ibActionbarLeft.setImageResource(R.drawable.leftarrow);
        ibActionbarLeft.setOnClickListener(this);
        ibActionbarRight.setVisibility(View.GONE);
        tvActionBarTitle.setText("添加银行卡");
    }

    @Override
    protected View initView() {
        View view = View.inflate(this, R.layout.activity_addbankcard, null);
        ButterKnife.bind(this, view);
        return view;
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick({R.id.addbankcard_ll_selectbank, R.id.addbankcard_tv_add})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.ib_actionbar_left:
                finish();
                break;
            case R.id.addbankcard_ll_selectbank: //选择银行


                break;
            case R.id.addbankcard_tv_add://确认添加
                String banknum = mTvBanknumber.getText().toString().trim();
                String bankname = mTvBankname.getText().toString().trim();
                break;
        }
    }

    /**
     * 标准提醒dialog
     * @param c
     * @param msg   提示的内容
     */
    public static void showToOpenCgDialog(Context c, String msg){
        AlertDialog mDialog = new AlertDialog.Builder(c).setCancelable(true).create();
        mDialog.show();
        Window window = mDialog.getWindow();

        //window.setContentView(R.layout.dialog_selectbank);
//        TextView msgTV = (TextView) window.findViewById(R.id.tv_msg);
//        TextView submitTV = (TextView) window.findViewById(R.id.tv_submit);
//        msgTV.setText(msg);
//        submitTV.setOnClickListener(new View.OnClickListener() {
//
//            @Override
//            public void onClick(View v) {
//                mDialog.dismiss();
//            }
//        });
    }
}
